/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.pablow.dao.serializables;

import com.pablow.model.Role;
import java.io.Serializable;
import java.util.List;

/**
 *
 * @author Administrador
 */
public class RoleDAOSer extends GenericDAOSer<Role,Serializable> {

     @Override
    public Role save(Role role) {
        role.setId(System.currentTimeMillis());
        return this.persist(role);
    }

    @Override
    public List<Role> getAll() {
        return this.getAll(Role.class);
    }

    public Role getRole(Long id){
        List<Role> roles=this.getAll();
        Role roleSearched=null;
        for (Role r:roles){
            if (r.getId().equals(id)){
                roleSearched=r;
                break;
            }
        }
        return roleSearched;
    }

    @Override
    public Boolean remove(Role role) {
        return this.remove(role);
    }

}
